import { _decorator } from 'cc';
import { Logger } from './utils/log';
const { ccclass, property, integer, uniquelyReferenced } = _decorator

@uniquelyReferenced
@ccclass('store')
export class StoreManager {

  @property
  chapter: LDChapter.Chapter

  @integer
  private _currentFrameId = 0;

  #log = new Logger('#StoreManager#')

  constructor() {
    this.#log.debug('数据库实例化')
  }
  get currentFrame() {
    return this.chapter.frames.map[this._currentFrameId]
  }

  set stepTo(frameId: number) {
    this._currentFrameId = frameId
  }

  getResource(resourceId: number): LDChapter.Resource {
    return this.chapter.resources[resourceId]
  }

}



export const storeManager = new StoreManager();
